﻿using FluentValidation;
using System;
using System.Collections.Generic;
using System.Text;
using xiaodingmarket_Domain.Validations;
using static xiaodingmarket_Domain.Models.EunmType;

namespace xiaodingmarket_Domain.Commands
{
    public class CreateNewCommodityCommand:CommodityCommand
    {
        public CreateNewCommodityCommand()
        {
        }

        public CreateNewCommodityCommand(Guid id,Kind kind, Category category, DateTime endtime, string remark, string detile, string title, string[] img, decimal price)
        {
            Id = id;
            Kind = kind;
            Category = category;
            this.endtime = endtime;
            Remark = remark;
            Detile = detile;
            Title = title;
            Img = img;
            Price = price;
        }

        
        /// <summary>
        /// 品目分类
        /// </summary>
        public Category Category { get; set; }
        /// <summary>
        /// 设定的自动截止时间,普通商品默认为无期
        /// </summary>
        public DateTime endtime { get; private set; }
        /// <summary>
        /// 备注（用户自定义标签等）)
        /// </summary>
        public string Remark { get; set; }
        /// <summary>
        /// 商品详情
        /// </summary>
        public string Detile { get; set; }
        /// <summary>
        /// 商品标题
        /// </summary>
        public string Title { get; set; }
        /// <summary>
        /// 商品图片
        /// </summary>
        public string[] Img { get; set; }
        /// <summary>
        /// 商品价格
        /// </summary>
        public decimal Price { get; set; }

        public override bool IsValid()
        {
            ValidationResult = new CreatNewCommodityCommandValidation().Validate(this);
            return ValidationResult.IsValid;
        }
    }
}
